<?php
if(!isset($_SESSION)) session_start();
if(isset($_GET["logout"]) && isset($_SESSION["logged_user"])){ unset($_SESSION["logged_user"]); $_SESSION["logged_bool"]=false;}
require_once("loginclass.php");
?>
﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <?php
        require('../../Smarty/libs/Smarty.class.php');

        $smarty = new Smarty;

        $username = "";
        $logged = false;
        $formUserValue = "enter user name here...";
        if(isset($_POST["user"])) $formUserValue = $_POST["user"];
        if(isset($_SESSION["logged_user"])) {
            $username = $_SESSION["logged_user"];
            $_SESSION["logged_bool"] = true;
            $logged = true;
            $url = 'index.php';
            header("Location: $url");
        }

        $created = false;
        if(isset($_SESSION["account_created"])) {
            unset($_SESSION["account_created"]);
            $created = true;
        }
        $smarty->assign("created",$created);
        $smarty->assign("logged",$logged);
        $smarty->assign("username",$username);
        $smarty->assign("formUserValue",$formUserValue);

        $smarty->setTemplateDir('./smarty/templates/');
        $smarty->setCompileDir('./smarty/templates_c/');
        $smarty->setConfigDir('./smarty/configs/');
        $smarty->setCacheDir('./smarty/cache/');

        $smarty->display('preHeader.tpl');
        echo '<body style="position: relative; top:-16px; " >';

        $smarty->display('header.tpl');
        $smarty->display('flashyBox.tpl');
        $smarty->display('loginPage.tpl');
        $smarty->display('footer.tpl');


        ?>

    <script type="text/javascript">
$(document).ready(function() {
<?php if($login->getStatus()==1) { ?>
          $("#login_error").css("visibility","visible");
<?php } ?>
});
    </script>
        </body>

</html>
